From 09f0052697e5c5d87b0c2a5aa062eae72f1a3ecf Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Mon, 12 Nov 2018 09:13:28 -0700 Subject: [PATCH] fix clazy detected 'c++11 range-loop might detach Qt container' these are from -Wclazy-range-loop --- csv_util.cc | 6 +++--- gpx.cc | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/csv_util.cc b/csv_util.cc index af70bfa5b..034e34a34 100644 --- a/csv_util.cc +++ b/csv_util.cc @@ -1593,7 +1593,7 @@ xcsv_waypt_pr(const Waypoint* wpt) } int i = 0; - for (const auto& fmp : xcsv_file.ofields) { + for (const auto& fmp : qAsConst(xcsv_file.ofields)) { double lat = latitude; double lon = longitude; /* @@ -2183,7 +2183,7 @@ xcsv_data_write(void) waypt_out_count = 0; /* output prologue lines, if any. */ - for (const auto& line : xcsv_file.prologue) { + for (const auto& line : qAsConst(xcsv_file.prologue)) { QString line_to_write = xcsv_replace_tokens(line); *xcsv_file.stream << line_to_write << xcsv_file.record_delimiter; } @@ -2199,7 +2199,7 @@ xcsv_data_write(void) } /* output epilogue lines, if any. */ - for (const auto& line : xcsv_file.epilogue) { + for (const auto& line : qAsConst(xcsv_file.epilogue)) { QString line_to_write = xcsv_replace_tokens(line); *xcsv_file.stream << line_to_write << xcsv_file.record_delimiter; } diff --git a/gpx.cc b/gpx.cc index f0ee94ab1..43606dde0 100644 --- a/gpx.cc +++ b/gpx.cc @@ -20,20 +20,28 @@ */ #include "defs.h" -#include "cet_util.h" #include "garmin_fs.h" #include "garmin_tables.h" +#include "src/core/datetime.h" #include "src/core/file.h" #include "src/core/logging.h" #include "src/core/xmlstreamwriter.h" #include "src/core/xmltag.h" -#include -#include -#include -#include +#include // for QDateTime, QDate, QTime +#include // for QHash +#include // for QList +#include // for QString, QStringLiteral, QStringRef, QStaticStringData, QLatin1String, operator+ +#include // for QStringList +#include // for QXmlStreamAttributes +#include // for QXmlStreamNamespaceDeclarations +#include // for QXmlStreamReader, QXmlStreamReader::TokenType::Characters, QXmlStreamReader::TokenType::EndDocument, QXmlStreamReader::TokenType::EndElement, QXmlStreamReader::TokenType::Invalid, QXmlStreamReader::TokenType::StartElement +#include // for qAsConst -#include +#include // for lround +#include // for sscanf +#include // for atoi, strtod +#include // for strchr static QXmlStreamReader* reader; @@ -1302,7 +1310,7 @@ gpx_wr_init(const QString& fname) } else { if (gpx_global) { // TODO: gpx 1.1 copyright goes here - for (const auto& l : gpx_global->link) { + for (const auto& l : qAsConst(gpx_global->link)) { writer->writeStartElement(QStringLiteral("link")); writer->writeAttribute(QStringLiteral("href"), l.url_); writer->writeOptionalTextElement(QStringLiteral("text"), l.url_link_text_); -- 2.30.2